' ***^^^***|||***^^^***
' 
'  This file is regenerated until it's edited. Delete the file to force regeneration.

'  NOTE: This denotes the way the file was created and it's possible the 
'        generation type has since changed.
'        Check the generation script for the curent state of the file.

' %%%###%%%b301cebf54de836d37d1f3f65be5a30f%%%###%%%
' %%%##NoWS##%%%ef51433717bd4e0eaa044a7b5c2cfb2a%%%##NoWS##%%%
' ***^^^***|||***^^^***


'************************************************************************************
' Copyright © 2003-2006 Kathleen Dollard
'
' This software is provided 'as-is', without any express or implied warranty. In no 
' event will the author be held liable for any damages arising from the use of this
' software.
' 
' You may use this software for any purpose, including commercial applications, 
' and you may redistribute this software as part of application delivery: however, 
' this copyright notice may not be removed and you may not otherwise redistribute 
' this software directly other than providing a link to wwww.gendotnet.com. 
'
' You may alter this software to better server your needs (I'd like to hear about your 
' changes in order to make the software better). If you alter the softwre, you must  
' clearly mark it as altered and must not be misrepresented as the original software.
' nor wholly your original work.
'*************************************************************************************

Option Explicit On
Option Strict On

Imports System
Imports System.Collections.Generic
Imports KadGen.Utility2005
Imports KadGen.MetadataWrapper


Public Class Map
   Inherits genMap

   Private mChildStack As New Stack(Of String)

   Public Shared Sub StartMappingRoot( _
              ByVal xmlWriter As Xml.XmlWriter, _
              ByVal MappingRoot As MetadataWrapper.MapMappingRoot)
      xmlWriter.WriteStartElement("orm", "MappingRoot", ns)
      XmlHelpers.WriteAttribute(xmlWriter, "MapDataStructure", MappingRoot.MapDataStructure)
      XmlHelpers.WriteAttribute(xmlWriter, "TransactionType", MappingRoot.TransactionType)
      XmlHelpers.WriteAttribute(xmlWriter, "Namespace", MappingRoot.Namespace)
      XmlHelpers.WriteAttribute(xmlWriter, "TransactionForRetrieve", MappingRoot.TransactionForRetrieve)
      XmlHelpers.WriteAttribute(xmlWriter, "RetrievePattern", MappingRoot.RetrievePattern)
      XmlHelpers.WriteAttribute(xmlWriter, "SetSelectPattern", MappingRoot.SetSelectPattern)
      XmlHelpers.WriteAttribute(xmlWriter, "CreatePattern", MappingRoot.CreatePattern)
      XmlHelpers.WriteAttribute(xmlWriter, "UpdatePattern", MappingRoot.UpdatePattern)
      XmlHelpers.WriteAttribute(xmlWriter, "DeletePattern", MappingRoot.DeletePattern)
      XmlHelpers.WriteAttribute(xmlWriter, "Generate", MappingRoot.Generate)
      XmlHelpers.WriteAttribute(xmlWriter, "CollectionType", MappingRoot.CollectionType)
      Dim outputter As New Map()
      outputter.OutputSQLFunctionReplacement(xmlWriter, MappingRoot.MapSQLFunctionReplacement)
      outputter.OutputUniqueNamespaces(xmlWriter, MappingRoot.MapUniqueNamespaces)
      outputter.OutputSpecialTypes(xmlWriter, MappingRoot.MapSpecialTypes)
   End Sub

   Public Shared Sub EndMappingRoot( _
            ByVal xmlWriter As Xml.XmlWriter, _
            ByVal MappingRoot As MetadataWrapper.MapMappingRoot)
      xmlWriter.WriteEndElement()
   End Sub

   Public Shared Shadows Sub OutputWrapperPart( _
           ByVal xmlWriter As Xml.XmlWriter, _
           ByVal Mapping As MetadataWrapper.MapMapping)
      Dim outputter As New Map()
      outputter.OutputThisWrapperPart(xmlWriter, Mapping)
   End Sub

   Protected Shadows Sub OutputThisWrapperPart( _
            ByVal xmlWriter As Xml.XmlWriter, _
            ByVal Mapping As MetadataWrapper.MapMapping)
      Me.OutputMapping(xmlWriter, Mapping)
   End Sub

   Protected Overrides Sub OutputChild( _
            ByVal xmlWriter As System.Xml.XmlWriter, _
            ByVal MapChild As MetadataWrapper.MapChild)
      'If Me.mChildStack.Contains(MapChild.Name) Then
      ' It's already in the stack, if we repeat it we'll recurse and get a headache
      xmlWriter.WriteStartElement(nsPrefix, "Child", ns)
      Me.OutputChildProperties(xmlWriter, MapChild)
      XmlHelpers.WriteAttribute(xmlWriter, "DescendantsTruncated", "true")
      'Else
      'mChildStack.Push(MapChild.Name)
      'MyBase.OutputChild(xmlWriter, MapChild)
      'mChildStack.Pop()
      'End If
   End Sub

End Class

Public Class MapCollection
   Inherits genMapCollection

End Class

